<template>
  <div id="newsList">
      <ul class="mui-table-view">
        <li v-for="item in newslist" :key="item.id" class="mui-table-view-cell mui-media">
            <router-link :to="{name:'newsinfo',params:{id:item.id}}">
                <img class="mui-media-object mui-pull-left" :src="item.img_url">
                <div class="mui-media-body">
                    {{item.title}}
                    <p class='mui-ellipsis'>{{item.zhaiyao}}</p>
                    <div><span>提交时间:{{item.add_time | datefmt('YYYY-MM-DD hh:mm:ss')}}</span><span>{{item.click}}</span></div>
                </div>
            </router-link>
        </li>
	</ul>
  </div>
</template>

<script>
import axios from 'axios'
import common from '../../kits/common'
export default {
  name: 'newslist',
  data () {
      return {
          newslist: []
      }
  },
  created () {
      axios.get(common.apidomain+"/api/getnewslist")
      .then(response=>{  
        response = response.data;
        if(response.status != 0) {
            return
        };
        this.newslist = response.message;
        console.log(this.newslist)
      })
  }
}
</script>

<style scoped>
    #newsList {
        width: 100%;
        padding: 50px 0;
        background-color: #ccc
    }
    .news-item {
        width: 100%;
        display: flex;
        padding: 5px;
        margin-bottom: 8px;
        background-color: white
    }
    .image {
        flex: 3
    }
    .image img {
        width: 100%
    }
    .news {
        flex: 7
    }

    
</style>

